<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBannersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('banners', function (Blueprint $table) {
            $table->id();
            $table->string('title')->comment('标题');
            $table->string('sign',20)->comment('广告图类型');
            $table->foreign('sign')->references('sign')->on('banner_signs')->onDelete('cascade');
            $table->string('image')->comment('图片');
            $table->string('link_type',20)->comment('链接类型:inside-内部页面、outside-外部页面、web-网页');
            $table->string('link')->comment('链接');
            $table->boolean('valid')->default(TRUE)->comment('是否有效');
            $table->integer('order')->unsigned()->default(0)->comment('排序');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('banners');
    }
}
